const faultSys = [
    {"label":'车门系统',
    "value": '车门系统'},
    {"label":'牵引系统',
        "value": '牵引系统'},
    {   "label":'制动系统',
        "value": '制动系统'},
    {"label":'走行部',
        "value": '走行部'},
    {"label":'空调系统',
        "value": '空调系统'},
    {"label":'乘客报警',
        "value": '乘客报警'}
]
const trainOptions=[
    {
        "label": "017016",
        "value": "017016"
    },{
        "label": "017017",
        "value": "017017"
    },{
        "label": "017018",
        "value": "017018"
    },{
        "label": "017019",
        "value": "017019"
    },
]
const faultLevelOptions=[
    {
        "label": "严重",
        "value": "严重"
    },{
        "label": "中等",
        "value": "中等"
    },{
        "label": "轻微",
        "value": "轻微"
    }
]
const faultListTrace = {
    result:{
        records:[{
            id: '1',
            lineCode:'GZML18',
            trainCode: '017018',
            coachNo: '1',
            systemCode: '牵引系统',
            faultLevel: '严重',
            faultCode: '9007',
            faultName: '电机1温度传感器故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '256s'
        }, {
            id: '2',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '1',
            systemCode: '牵引系统',
            faultLevel: '中等',
            faultCode: '9008',
            faultName: '电机1温度故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '256s'
        }, {
            id: '3',
            lineCode:'GZML18',
            trainCode: '18001003',
            coachNo: '2',
            systemCode: '牵引系统',
            faultLevel: '中等',
            faultCode: '9009',
            faultName: '电机1整个坏掉',
            faultPart: ['电机滤网','电机轴承'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '25s'
        }
        ]
    }
}
const faultListMid = {
    result:{
        records:[{
            id: '1',
            lineCode:'GZML18',
            trainCode: '017018',
            coachNo: '1',
            systemCode: '牵引系统',
            faultLevel: '中等',
            faultCode: '9007',
            faultName: '电机1温度传感器故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '256s'
        }, {
            id: '2',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '1',
            systemCode: '牵引系统',
            faultLevel: '中等',
            faultCode: '9008',
            faultName: '电机1温度故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '256s'
        }, {
            id: '3',
            lineCode:'GZML18',
            trainCode: '18001003',
            coachNo: '2',
            systemCode: '牵引系统',
            faultLevel: '中等',
            faultCode: '9009',
            faultName: '电机1整个坏掉',
            faultPart: ['电机滤网','电机轴承'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '25s'
        }
        ]
    }
}
const faultListBegin = {
    result:{
        records:[{
            id: '1',
            lineCode:'GZML18',
            trainCode: '017018',
            coachNo: '1',
            systemCode: '牵引系统',
            faultLevel: '中等',
            faultCode: '9007',
            faultName: '电机1温度传感器故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '256s'
        }, {
            id: '2',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '1',
            systemCode: '牵引系统',
            faultLevel: '中等',
            faultCode: '9008',
            faultName: '电机1温度故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '256s'
        }, {
            id: '3',
            lineCode:'GZML18',
            trainCode: '18001003',
            coachNo: '2',
            systemCode: '牵引系统',
            faultLevel: '中等',
            faultCode: '9009',
            faultName: '电机1整个坏掉',
            faultPart: ['电机滤网','电机轴承'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '25s'
        }
        ]
    }
}
const faultListEnd = {
    result:{
        records:[{
            id: '1',
            lineCode:'GZML18',
            trainCode: '017018',
            coachNo: '1',
            systemCode: '牵引系统',
            faultLevel: '中等',
            faultCode: '9007',
            faultName: '电机1温度传感器故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 9:00',
            duration: '256s'
        }, {
            id: '2',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '1',
            systemCode: '牵引系统',
            faultLevel: '中等',
            faultCode: '9008',
            faultName: '电机1温度故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 9:00',
            duration: '256s'
        }, {
            id: '3',
            lineCode:'GZML18',
            trainCode: '18001003',
            coachNo: '2',
            systemCode: '牵引系统',
            faultLevel: '中等',
            faultCode: '9009',
            faultName: '电机1整个坏掉',
            faultPart: ['电机滤网','电机轴承'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 9:00',
            duration: '25s'
        }
        ]
    }
}
const faultList18001002 = {
    result:{
        records:[{
            id: '1',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '1',
            systemCode: '牵引系统',
            faultLevel: '严重',
            faultCode: '9007',
            faultName: '电机1温度传感器故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '256s'
        }, {
            id: '2',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '1',
            systemCode: '制动系统',
            faultLevel: '中等',
            faultCode: '9010',
            faultName: '电机1温度故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '200s'
        }, {
            id: '3',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '2',
            systemCode: '走行部',
            faultLevel: '中等',
            faultCode: '9009',
            faultName: '走行部坏了',
            faultPart: ['电机滤网','电机轴承'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '2s'
        },{
            id: '4',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '1',
            systemCode: '牵引系统',
            faultLevel: '严重',
            faultCode: '9023',
            faultName: '电机1温度传感器故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '256s'
        }, {
            id: '5',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '1',
            systemCode: '制动系统',
            faultLevel: '中等',
            faultCode: '9015',
            faultName: '电机1温度故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '200s'
        }, {
            id: '6',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '2',
            systemCode: '走行部',
            faultLevel: '中等',
            faultCode: '9008',
            faultName: '走行部坏了',
            faultPart: ['电机滤网','电机轴承'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '2s'
        }, {
            id: '6',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '2',
            systemCode: '走行部',
            faultLevel: '中等',
            faultCode: '9009',
            faultName: '走行部坏了',
            faultPart: ['电机滤网','电机轴承'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '2s'
        }, {
            id: '7',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '2',
            systemCode: '走行部',
            faultLevel: '中等',
            faultCode: '9022',
            faultName: '走行部坏了',
            faultPart: ['电机滤网','电机轴承'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '2s'
        }, {
            id: '9',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '2',
            systemCode: '走行部',
            faultLevel: '中等',
            faultCode: '9026',
            faultName: '走行部坏了',
            faultPart: ['电机滤网','电机轴承'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '2s'
        }
        ]
    }
}
const faultList = {
    result:{
        records:[{
            id: '1',
            lineCode:'GZML18',
            trainCode: '017018',
            coachNo: '1',
            systemCode: '牵引系统',
            faultLevel: '严重',
            faultCode: '9007',
            faultName: '电机1温度传感器故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '256s'
        }, {
            id: '2',
            lineCode:'GZML18',
            trainCode: '18001002',
            coachNo: '1',
            systemCode: '走行部',
            faultLevel: '中等',
            faultCode: '9008',
            faultName: '电机1温度故障',
            faultPart: ['电机滤网','电机轴承','电机温度传感器'],
            maintenanceAdvice: '运行结束后回库检修',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '256s'
        }, {
            id: '3',
            lineCode:'GZML18',
            trainCode: '18001003',
            coachNo: '2',
            systemCode: '空调',
            faultLevel: '中等',
            faultCode: '9009',
            faultName: '空调坏了',
            faultPart: ['电机滤网','电机轴承'],
            maintenanceAdvice: '重启',
            happenTime: '2021-11-19 9:00',
            endTime: '2021-11-19 11:00',
            duration: '64s'
        }
        ]
    }
}

const chartData={
        chartId:1,
        title: '很多参数',
        paraList:['温度', '电压', '电流','网压','载重'],
        xAxis: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
        datas:[{
            "name":"温度",
            data:[1,3,2,4,5,6,7]
        },{
            "name":"电压",
            data:[1,3,2,5,5,5,5]
        },{
            "name":"电流",
            data:[1,3,2,6,6,6,6]
        },{
            "name":"网压",
            data:[10,30,20,50,50,50,50]
        },{
            "name":"载重",
            data:[10,30,20,60,60,60,60]
        }],
}
const chartData1={
    chartId:1,
    title: '车辆参数',
    paraList:['温度', '电压', '电流'],
    xAxis: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun','Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    datas:[{
        "name":"温度",
        data:[1,3,2,4,5,6,7,1,3,2,4,5,6,7]
    },{
        "name":"电压",
        data:[1,3,2,5,5,5,5,1,3,2,5,5,5,5]
    },{
        "name":"电流",
        data:[10,30,20,50,50,50,50,10,30,20,50,50,50,50]
    }],
}
const chartData2={
    chartId:1,
    title: '弓网参数',
    paraList:['温度', '电压'],
    xAxis: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun','Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun','Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    datas:[{
        "name":"温度",
        data:[1,3,2,4,5,6,7,1,3,2,4,5,6,7,1,3,2,4,5,6,7]
    },{
        "name":"电流",
        data:[10,30,20,50,50,50,50,10,30,20,50,50,50,50,10,30,20,50,50,50,50]
    }],
}
export default {

    'post|faultManage/faultAlert': option => {
        let $trainCode=JSON.parse(option.body).trainCode;
        let $systemCode=JSON.parse(option.body).systemCode;
        let $faultLevel=JSON.parse(option.body).faultLevel;
        let $beginTime=JSON.parse(option.body).beginTime;
        let $endTime=JSON.parse(option.body).endTime;
        // console.log("post输出",$trainCode);
        if($trainCode == "18001002"){
            // console.log("返回18001002的数据！！！");
            return faultList18001002;
        }else if($systemCode == '牵引系统'){
            return faultListTrace;
            // console.log("返回牵引系统的数据！！！");
        }else if($faultLevel == "中等"){
            return faultListMid;

        }else if($beginTime == '2021-11-19 9:00'){
            return faultListBegin;

        }else if($beginTime == '2021-11-19 9:00'){
            return faultListEnd;
        }else{
            // console.log("返回所有的数据！！！");
            return faultList;
        }
    },
    'get|FaultManage/FaultAlert/Sys': faultSys,
    'get|FaultManage/FaultAlert/TrainList':trainOptions,
    'get|FaultManage/FaultAlert/FaultLevel':faultLevelOptions,
    // 'get|FaultManage/FaultAlert/chartData':chartData,
    'get|FaultManage/FaultAlert/chartData': option =>{
        // console.log("faultAlertMocktest:000",option);

        let start = option.url.indexOf('=');
        if(option.url.substring(start+1) == "9007") {
            // console.log("mock:9007");
            // console.log("faultAlertMocktest:000",option);
            return chartData;
        }else if(option.url.substring(start+1) == "9008"){
            // console.log("mock:9008");

            // console.log("option.body");
            // console.log("faultAlertMocktest:000",option);
            return chartData1;
        }else{
            // console.log("mock:非9007 非9008");
            return chartData2;
        }
    }

}